import{ storageGet } from '@/utils'
export const myDirective = { //权限按钮
    mounted(el, binding, vnode){
        if (!binding.value){
            return
        }
        const pe = storageGet('permission')
        let arr = []
        arr = binding.value.split(',')//'xx,xx'
        let hasPower = false
        arr.forEach(val => {
            if(pe[val]){
                hasPower = true
            }
        })
        if (!hasPower){
            el.style.display = 'none'
            setTimeout(()=>{
                if (el.parentNode){
                    el.parentNode.removeChild(el)
                }
            }, 0)
        }
    },
    // 元素更新时触发
    updated(el, binding, vnode){
    },

    // 指令解绑时触发
    unmounted(el, binding, vnode){
    }
}
